package com.dmitriyp.movie.console.actions;

import static java.lang.System.out;

import java.util.List;

import com.dmitriyp.movie.console.AbstractUserAction;
import com.dmitriyp.movie.console.UserInputUtil;
import com.dmitriyp.movie.dao.IMovieManager;
import com.dmitriyp.movie.mapping.Movie;

public class UserFilterAction extends AbstractUserAction {

    public UserFilterAction(IMovieManager manager) {
        super(manager);
    }

    public void doAction() {
        out.println("Enter word for search");
        String title = scanner.next();
        List<Movie> result = getManager().filter(title);
        for (Movie movie : result) {
            out.println(movie);
        }
        UserInputUtil.pressAnyKey();
    }

}
